module sys_rst(
	input		clk,
	input		systemclk_locked,
	output	rst_n
);

reg[31:0] cout;
reg rst_p_internal;

always@(posedge clk or negedge systemclk_locked)
begin
	if(!systemclk_locked)
	begin
		cout	<= 0;
		rst_p_internal	<= 0;
	end
	else if(cout >= 32'h02ff_ffff)
	begin
		rst_p_internal	<= 1;
	end
	else
	begin
		cout	<= cout + 1;
		rst_p_internal	<= 0;
	end
end

assign rst_n = rst_p_internal;

endmodule
